package self.hoy.demo.grainmall.auth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
import self.hoy.demo.grainmall.EnableRedisSession;

@RefreshScope
@EnableFeignClients("self.hoy.demo.grainmall.auth.feign")
@EnableDiscoveryClient
@SpringBootApplication
@EnableRedisSession// 启用redis整合session共享
public class AuthServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(AuthServerApplication.class, args);
    }

    @Bean
    @LoadBalanced//使得 RestTemplate 接入 Ribbon
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

}
